package com.hui.li.util;

import org.springframework.beans.factory.annotation.Autowired;

import java.util.concurrent.ThreadPoolExecutor;

/**
 * @projectName: Spring-RestTemplate
 * @package: com.hui.li.controller
 * @className: AsyncManager
 * @author: Hui
 * @date: 2021/12/22 23:32
 */

//通过线程池执行异步任务
public class AsyncManager {
    @Autowired
    private ThreadPoolExecutor threadPoolExecutor;
    //通过线程池执行
    public void execute(Runnable runnable){
        threadPoolExecutor.execute(runnable);
    }
}
